<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006-2016 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: 流年 <liu21st@gmail.com>
// +----------------------------------------------------------------------

// 应用公共文件
/**
 * 验证手机号格式
 * @method 
 * @author chengzhigang
 * @param $phone
 * @return 
 */
function check_phone($phone) {
	$search = '/^0?1[3|4|5|6|7|8][0-9]\d{8}$/';
	if (preg_match($search, $phone)) {
		return true;
	} else {
		return false;
	}
}
/**
 * 检测登录密码格式（英文、数字、下划线6-20位字符）(?!_)(?!.*?_$)(?!\d+$)
 * @method check_password
 * @author chengzhigang
 * @param $password
 * @return 
 */
function check_password($password) {
	$search = '/^[A-Za-z0-9]{6,20}$/u';
	if (preg_match($search, $password)) {
		return true;
	} else {
		return false;
	}
}